package com.twu.biblioteca.config;

import com.twu.biblioteca.models.entities.Book;
import com.twu.biblioteca.models.entities.Menu;
import com.twu.biblioteca.models.entities.Movie;
import com.twu.biblioteca.models.entities.User;
import com.twu.biblioteca.models.services.Libary;
import com.twu.biblioteca.models.services.UserService;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import static com.twu.biblioteca.config.MenuOption.*;

public class Initializer {
    public static void initializeMenu() {
        Menu.addMenuOption(MenuOption.LOGOIN);
        Menu.addMenuOption(LIST_BOOKS);
        Menu.addMenuOption(CHECKOUT_BOOK);
        Menu.addMenuOption(RETURN_BOOK);
        Menu.addMenuOption(LIST_MOVIES);
        Menu.addMenuOption(CHECKOUT_MOVIE);
        Menu.addMenuOption(QUIT);
    }

    public static void initializeLibary() {
        initializeBooks();
        initializeMovies();
    }

    public static void initializeMovies() {
        List<Movie> movies = new ArrayList<Movie>();
        movies.add(new Movie("movie1", "Mr Zhang", 2013, Rate.ONE));
        movies.add(new Movie("movie2", "Mr Li Li", 2010, Rate.UNRATED));
        movies.add(new Movie("movie33333333", "Mr Huange", 2014, Rate.FIVE));
        Libary.add(movies);
    }

    public static void initializeBooks() {
        List<Book> books = new ArrayList<Book>();
        books.add(new Book("book1", "Mr Zhang", new Date()));
        books.add(new Book("book2", "Mr Zhang", new Date()));
        books.add(new Book("book3", "Mr Zhang", new Date()));
        Libary.add(books);
    }

    public static void initializeUser() {
        UserService.add(new User("u1", "u1@gmail.com", "u1", "1234"));
        UserService.add(new User("u2", "u2@gmail.com", "u2", "12345"));
    }
}
